<html>
<head>
	<meta charset="UTF-8">
	<meta content="IE=edge" http-equiv="X-UA-Compatible">
	<meta content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, width=device-width" name="viewport">
	<title>2771：YY的Train</title>
	<!-- css -->
	<link href="../css/base.min.css" rel="stylesheet">
	<link href="../css/project.min.css" rel="stylesheet">
	
	<!-- favicon -->
	<!-- ... -->
</head>
<body class="page-brand">
	<header class="header header-transparent header-waterfall ui-header">
		<ul class="nav nav-list pull-left">
			<li>
				<a data-toggle="menu" href="#menu">
					<span class="icon icon-lg">menu</span>
				</a>
			</li>
		</ul>
		<a class="header-logo header-affix-hide margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">YY的Train</a>
		<span class="header-logo header-affix margin-left-no margin-right-no" data-offset-top="213" data-spy="affix">YY的Train</span>
	</header>
	<nav aria-hidden="true" class="menu" id="menu" tabindex="-1">
		<div class="menu-scroll">
			<div class="menu-content">
				<a class="menu-logo" href="../index.html">BZOJ离线题库</a>
				<ul class="nav">
					<li>
						<a class="waves-attach" data-toggle="collapse" href="#problems">题目</a>
						<ul class="menu-collapse collapse in" id="problems">
							<li>
								<a class="waves-attach" href="../index.html">主页</a>
							</li>
							<li>
								<a class="waves-attach" href="../list.html">题目列表</a>
							</li>
						</ul>
					</li>
					<li>
						<a class="collapsed waves-attach" data-toggle="collapse" href="#about">关于</a>
						<ul class="menu-collapse collapse" id="about">
							<li>
								<a class="waves-attach" href="../about.html">关于此项目</a>
							</li>
						</ul>
					</li>
					
				</ul>
			</div>
		</div>
	</nav>
	<main class="content">
		<div class="content-header ui-content-header">
			<div class="container">
				<h1 class="content-heading">
                YY的Train                </h1>
                <p>时间限制：10s&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  空间限制：128MB</p>			</div>
		</div>
		<div class="container">
			<section class="content-inner margin-top-no">
				<div class="row">
					<div class="col-lg-13 col-md-13">
						<div class="card margin-bottom-no">
							<div class="card-main">
								<div class="card-inner">
									
                                <h3>题目描述</h3><p><div style="text-indent: 21pt"><span style="font-size: medium">YY在学会了Treap之后更加努力了，于是乎他的灵魂穿越了时空到达了3838年3月8日参加了第38届UOI，凭借着快速转换农历和阴历的能力，他拿到了金牌第38名。功成名就之后友爱的YY小朋友终于当上了火车调度员。现在小YY面临着一个难题，如何把湘江东岸的粮食运到湘江西岸去。湘江沿岸总共有N个火车站，这N个火车站由M条双向铁路连接，并且保证<b>任意两个站点可以互达</b>。湘江东岸有east个火车站，湘江西岸有west个火车站（<b>当然可能有站点设置在江中</b>），其中东岸有P个火车站中停留了一列装满粮食的火车。YY的任务是合理安排让这P列火车停在P个<b>不同的</b>西岸站点。每条铁路通过的时间都是一天，当然铁路部门为了保证安全要求每一天一条铁路只能通过一列火车。火车在到达目标之前可以在任意站点停留任意天，每个站点最多可以停留P列火车。上级部门要求YY拿出一套方案使得最晚到达的火车尽早到达。当然YY作为UOI金牌有更加重要的事情（要和Daren Nicholas打篮球啦，要和Luciano踢足球啦）所以这个任务就交给你啦。</span></div>
<div><span style="font-size: medium">&nbsp;</span></div></p><hr/><h3>输入格式</h3><p><div style="text-indent: 21pt"><span style="font-size: medium">第一行四个整数N,M,east,west</span></div>
<div style="text-indent: 21pt"><span style="font-size: medium">接下来M行每行两个整数u,v描述一条连通u,v的铁路</span></div>
<div style="text-indent: 21pt"><span style="font-size: medium">倒数第二行一个整数P</span></div>
<div style="text-indent: 21pt"><span style="font-size: medium">最后一行P个整数，表示P列火车停留的地方</span></div>
<div style="text-indent: 21pt"><span style="font-size: medium">&nbsp;</span></div></p><hr/><h3>输出格式</h3><p><div><span style="font-size: medium">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 一个整数，表示最晚达到的火车达到的时间。</span></div>
<div><span style="font-size: medium">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></div></p><hr/><h3>样例输入</h3><pre>       2 1 1 1
       1 2
       1
       1
 
</pre><hr/><h3>样例输出</h3><pre>       1
 
</pre><hr/><h3>提示</h3><p><p>n&lt;=10^6,m=n-1,且保证存在一个站点将东岸和西岸的站点分开<br />
&nbsp;</p></p><hr/><h3>题目来源</h3><p>没有写明来源</p>
								</div>
							</div>
						</div>
					</div>
				</div>
				
				
			</section>
		</div>
	</main>

	<div class="fbtn-container">
		<div class="fbtn-inner">
			<a class="fbtn fbtn-lg fbtn-brand-accent waves-attach waves-circle waves-light waves-effect" data-toggle="dropdown" aria-expanded="true"><span class="fbtn-text fbtn-text-left">Menu</span><span class="fbtn-ori icon">apps</span><span class="fbtn-sub icon">close</span></a>
			<div class="fbtn-dropup">
				<a class="fbtn fbtn-brand waves-attach waves-circle waves-light waves-effect" href="../list.html" target="_self"><span class="fbtn-text fbtn-text-left">题目列表</span><span class="icon">menu</span></a>
				<a class="fbtn fbtn-green waves-attach waves-circle waves-effect" href="../index.html" target="_self"><span class="fbtn-text fbtn-text-left">返回主页</span><span class="icon">home</span></a>
				<a class="fbtn waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/submitpage.php?id=2771" target="_blank"><span class="fbtn-text fbtn-text-left">提交代码</span><span class="icon">send</span></a>
				<a class="fbtn fbtn-orange waves-attach waves-circle waves-effect" href="http://www.lydsy.com/JudgeOnline/wttl/wttl.php?pid=2771" target="_blank"><span class="fbtn-text fbtn-text-left">试题讨论</span><span class="icon">chat</span></a>
				
			</div>
		</div>
	</div>

	<!-- js -->
	<script src="../js/jquery.min.js"></script>
	<script src="../js/base.min.js"></script>
	<script src="../js/project.min.js"></script>
</body>
</html>